from toolsbox import avg_leng, str_extract_float
from ansys_python_interface import find_or_initial_project
from params_setting import params_setting
from stator_model import stator_model
from rotor_model import rotor_model
from magnets_model import magnets_model
from coils_model import coils_model
from current_excitation_setting import current_excitation_setting
from band_model import band_model
from mesh_setting import mesh_setting
from model_setting import model_setting
from analysis_setting import analysis_setting
from optimetrics_setting import optimetrics_setting
from report_setting import report_setting
stator_params = {
"Dsi": "0.1mm",
"Dso": "0.1mm",
"slot": "18",
"Hs0": "0.1mm,
"Hs1": "0.1mm",
"Hs2": "0.1mm",
"Bs0": "0.1mm",
"Bs1": "0.1mm",
"Bs2": "0.1mm",
"Rs": "0.1mm"
}
rotor_params = {
"Dro": "0.1mm",
"Dri": "0.1mm",
"pole": "20",
"rotor_type": "0",
"mag_emb": "0.0",
"mag_thick": "0.1mm",
"mag_width": "0.1mm",
"rotor_bridge": "0.1mm",
"rotor_rib": "0.1mm",
}
motor_params = {
"ini_angle": "0.1deg",
"speed_rpm": "1000rpm",
"length" : "0.1mm",
"multiplier": "0"
}
band_params = {
"rota_band_D": "(Dsi + Dro) / 2",
"outer_band_D": "(Dso)*1.1",
"shaft": "Dri",
}
excitation_params = {
"N" : "0",
"Im": "0A",
"f_ele": "speed_rpm/60*(pole/2)/1rpm",
"lead_ang": "0deg",
"I_ph_A": "Im*sqrt(2)*sin((360*f_ele*Time+lead_ang)*pi/180)",
"I_ph_B": "Im*sqrt(2)*sin((360*f_ele*Time+lead_ang+120)*pi/180)",
"I_ph_C": "Im*sqrt(2)*sin((360*f_ele*Time+lead_ang-120)*pi/180)",
}
name_dirt = {
"band_name": ["rotaband", "outerband"],
"excitation_name": ["N", "I_ph_A", "I_ph_B", "I_ph_C"]
}
analysis_params = {
"name": "setup1",
"stoptime": "1/f_ele",
"timestep": "1/f_ele/50"
}
optiparametric_variables = {
"Im": "0A 5A 10A"
}
report_list = ["Moving1.Torque", "InducedVoltage(Winding_A)"]
total_mech_params = {**stator_params, **rotor_params, **motor_params, **band_params, **excitation_params}
oProject, oDesign, oEditor = find_or_initial_project()
params_setting(oDesign, total_mech_params)
stator_model(oEditor, list(stator_params.keys()))
rotor_model(oEditor, list(rotor_params.keys()))
magnets_model(oEditor, int(rotor_params["pole"]), list(rotor_params.keys()))
coil_name_list = coils_model(oEditor, int(stator_params["slot"]))
model_setting(oDesign, motor_params["length"], motor_params["multiplier"])
current_excitation_setting(oDesign, coil_name_list, name_dirt["excitation_name"])
band_model(oDesign, oEditor, name_dirt["band_name"])
mesh_setting(oDesign, name_dirt["band_name"])
analysis_setting(oDesign, analysis_params["name"], analysis_params["stoptime"], analysis_params["timestep"])
opt_oModule, opt_name = optimetrics_setting(oProject, oDesign, optiparametric_variables, analysis_params["name"])
opt_oModule.SolveSetup(opt_name)
report_setting(oDesign, report_list)
有點長,先看看大概,待接下來的天數會一一介紹裡面內容